using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace BPMN.MainWindow
{
    public class FigureParentChild
    {
  
        FigureParentChild child;
        string name;
        FigureType figureType;
        #region Properties
        public FigureParentChild Child
        {
            get
            {
                return child;
            }
            set
            {
                child = value;
            }
        }
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
        public FigureType FigureType
        {
            get
            {
                return figureType;
            }
            set
            {
                figureType = value;
            }
        }
        #endregion
        public FigureParentChild(string name, FigureParentChild child, FigureType figureType)
        {
            this.name = name;
            this.child = child;
            this.figureType = figureType;
        }
    }
    public class Figure : ICloneable
    {
        #region Fields
     Region region;
        Color backgroundColor;
        Color foreColor;
        GraphicsPath path;
        RectangleF boundingBox;
        RectangleF resizeBoundingBox;
        FigureState state = FigureState.Unselected;
        string name = "Pool";
        SizeF size = new SizeF(0, 0);
        PointF location = new PointF(0, 0);

        #endregion
        #region Properties
        public Region Region
        {
            get
            {
                return region;
            }
            set
            {
                region = value;
            }
        }
        public PointF Location
        {
            get
            {
                return location;
            }
            set
            {
                PointF aux = location;
                location = value;
                UpdateSomeParametersLocation(aux);
            }
        }
        public SizeF Size
        {
            get
            {
                return size;
            }
            set
            {
                SizeF aux = size;
                size = value;
                UpdateSomeParametersSize(aux);
            }
        }
        public GraphicsPath Path
        {
            get
            {
                return path;
            }
            set
            {
                path = value;
            }
        }
        public Color BackColor
        {
            get
            {
                return backgroundColor;
            }
            set
            {
                backgroundColor = value;
            }
        }
        public Color ForeColor
        {
            get
            {
                return foreColor;
            }
            set
            {
                foreColor = value;
            }
        }
        public RectangleF BoundingBox
        {
            get
            {
                return boundingBox;
            }
            set
            {
                boundingBox = value;
            }
        }
        public RectangleF ResizeBoundingBox
        {
            get
            {
                return resizeBoundingBox;
            }
            set
            {
                resizeBoundingBox = value;
            }
        }
        public FigureState State
        {
            get
            {
                return state;
            }
            set
            {
                state = value;
            }
        }
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
        #endregion
        public virtual void Draw(Graphics graphics, Pen pen, Brush brush, PointF offset)
        {
        }
        public virtual void UpdateSomeParametersLocation(PointF newLocation)
        {
        }
        public virtual void UpdateSomeParametersSize(SizeF newSize)
        {
        }
        #region ICloneable Members

        public virtual object Clone()
        {
            Figure figure = new Figure();
            figure.BackColor = this.BackColor;
            figure.BoundingBox = this.BoundingBox;
            figure.ForeColor = this.ForeColor;
            figure.Name = this.name;
            figure.Path = this.path;
            figure.ResizeBoundingBox = this.ResizeBoundingBox;
            figure.State = this.State;
            return figure;
        }

        #endregion
    }
    public delegate void FigureEvent(object sender, FigureUpdateEventArgs args);
    public enum FigureEventType
    {
        New,
        Delete,
        Modified,
        Selection
    
    }
    public enum FigureType
    {
        Pool,
        Lane
    }
    public class FigureUpdateEventArgs
    {
        FigureType figureType;
        FigureEventType type;
        FigureParentChild oldFigure = null;
        FigureParentChild newFigure =null;
        public FigureEventType Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }

        public FigureParentChild OldFigure
        {
            get
            {
                return oldFigure;
            }
            set
            {
                oldFigure = value;
            }
        }

        public FigureParentChild NewFigure
        {
            get
            {
                return newFigure;
            }
            set
            {
                newFigure = value;
            }
        }

        public FigureType FigureType
        {
            get
            {
                return figureType;
            }
            set
            {
                figureType = value;
            }
        }
        public FigureUpdateEventArgs()
        {
        }
        public FigureUpdateEventArgs(FigureParentChild oldFigure, FigureParentChild newFigure, FigureEventType type, FigureType figureType)
        {
            this.oldFigure = oldFigure;
            this.newFigure = newFigure;
            this.type = type;
            this.figureType = figureType;
        }
    }

}
